package com.nlscan.qdkit.ui.publico.manager;

/**
 * App状态管理器
 * -- 处理App久置后台被系统强杀，重启后重走启动逻辑
 * Created by QING on 2018/11/30.
 */

public class AppStatusManager {

    public static final int STATUS_FORCE_KILLED = -1; // APP未启动/应用在后台被强杀
    public static final int STATUS_NORMAL_START = 0; // APP正常启动

    private int appStatus = STATUS_FORCE_KILLED;

    private AppStatusManager() {
    }

    private static class SingletonHolder {
        private static AppStatusManager instance = new AppStatusManager();
    }

    public static AppStatusManager getInstance() {
        return SingletonHolder.instance;
    }

    public int getAppStatus() {
        return appStatus;
    }

    public void setAppStatus(int appStatus) {
        this.appStatus = appStatus;
    }

    /**
     * 应用此时已正常启动
     *
     * @return
     */
    public boolean isNormalStart() {
        return appStatus == STATUS_NORMAL_START;
    }
}
